package com.xintoucloud.pbs.dao.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.xintoucloud.pbs.dao.MeetingPictureDao;
import com.xintoucloud.pbs.entity.MeetingPicture;
@Repository@Transactional
public class MeetingPictureDaoImpl implements MeetingPictureDao{
    
	@Autowired
	private SessionFactory sessionFactory;
	@Override
	public Serializable save(MeetingPicture meetingPicture) {
		return sessionFactory.getCurrentSession().save(meetingPicture);
	}

	@Override
	public void delete(Integer mpid) {
		sessionFactory.getCurrentSession().delete(mpid);
	}

	@SuppressWarnings("unchecked")
	@Override
	@Transactional(readOnly=true)
	public List<MeetingPicture> list(String meetingNum) {
		return sessionFactory.getCurrentSession().createQuery("from MeetingPicture where meetingNum=?0")
				.setParameter(0, meetingNum)
				.getResultList();
	}

}
